package de.ifi.lmu.snitzelhunt.participants;

import de.ifi.lmu.snitzelhunt.R;
import android.app.AlertDialog;
import android.app.Dialog;
import android.content.DialogInterface;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentManager;

/**
 * 
 * @author Sebastian Siepe
 *
 */
public class PopupDialog extends DialogFragment {
	@Override
	public Dialog onCreateDialog(Bundle savedInstanceState) {

		// 1. Instantiate an AlertDialog.Builder with its constructor
		AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());

		// 2. Chain together various setter methods to set the dialog
		// characteristics
		builder.setTitle(R.string.popup_dialog_title);
		builder.setMessage(R.string.popup_dialog_message);

		// 3. Get the AlertDialog from create()
		// AlertDialog dialog = builder.create();

		builder.setPositiveButton(R.string.popup_dialog_button2,
				new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int id) {
						// FIRE ZE MISSILES!
					}
				}).setNegativeButton(R.string.popup_dialog_button1,
				new DialogInterface.OnClickListener() {
					public void onClick(DialogInterface dialog, int id) {
						// User cancelled the dialog
					}
				});
		// Create the AlertDialog object and return it
		return builder.create();
	}
	@Override
	public void show(FragmentManager manager, String tag) {
		// TODO Auto-generated method stub
		try {
			super.show(manager, tag);
		} catch (IllegalStateException ex) {
		}
	}
}
